using System.Collections;
using Castle.Windsor;
using Castle.Windsor.Configuration.Interpreters;
using OFX.Aggregator.Infrastructure;

namespace OFX.Aggregator.Application
{
	public class WindsorContainer : IContainer
	{
		private readonly IWindsorContainer container;

		#region Implementation of IContainer

		public T Resolve<T>()
		{
			return this.container.Resolve<T>();
		}

		public T Resolve<T>(IDictionary parameters)
		{
			return this.container.Resolve<T>(parameters);
		}

		public T Resolve<T>(string key)
		{
			return this.container.Resolve<T>(key);
		}

		public T Resolve<T>(string key, IDictionary parameters)
		{
			return this.container.Resolve<T>(key, parameters);
		}

		#endregion

		public WindsorContainer()
		{
#if DEBUG
			const string configFile = @"config\IoC-debug.config";
#else
			const string configFile = @"config\IoC.config";
#endif

			this.container = new Castle.Windsor.WindsorContainer(new XmlInterpreter(configFile));
		}
	}
}